package form;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

import trangchu.UtilDelegate;

public class DSJ_NhomHang {
	public String MaNH;
	public String TenNH;
	
	public String getMaNH() {
		return MaNH;
	}
	public void setMaNH(String maNH) {
		MaNH = maNH;
	}
	public String getTenNH() {
		return TenNH;
	}
	public void setTenNH(String tenNH) {
		TenNH = tenNH;
	}
	
	public Vector<DSJ_NhomHang> getUsers(){
		Vector list = new Vector();;
		Connection con =UtilDelegate.getConnection();		
		PreparedStatement st;
		try {
			st = con.prepareStatement("select * from NhomHang join DonVi on NhomHang.DVNH = DonVi.MaDV");
			ResultSet rs = st.executeQuery();
			while(rs.next()){
				
				Vector<String> b = new Vector<String>();
				b.add(rs.getString("MaNH"));
				b.add(rs.getString("TenNH"));
				b.add(rs.getString("TenDV"));
				
				list.add(b);
								
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return list;
	}
}
